<!DOCTYPE html>
<%@ taglib prefix="s" uri="/struts-tags"%>
<html>
<head>
<title><s:property value="getText('app.title')" /></title>
<meta http-equiv="Pragma" content="no-cache" />
<meta http-equiv="Cache-Control" content="no-cache" />
<meta http-equiv="Cache-Control" content="no-store" />
<link href="${pageContext.request.contextPath}/css/jquery-ui-combobox.custom.css" rel="stylesheet"
  type="text/css" />
<link href="${pageContext.request.contextPath}/css/login.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath}/css/theme/jquery-ui.custom.css" rel="stylesheet"
  type="text/css" />
<link href="${pageContext.request.contextPath}/css/grid/ui.jqgrid.css" rel="stylesheet"
  type="text/css" />
<link href="${pageContext.request.contextPath}/css/style.css" rel="stylesheet" type="text/css" />
<link href="${pageContext.request.contextPath}/css/jquery-multiselect-2.0.css" rel="stylesheet"
  type="text/css" />
<link href="${pageContext.request.contextPath}/css/ui.multiselect.ext.css" rel="stylesheet"
  type="text/css" />
<link href="${pageContext.request.contextPath}/css/jquery.ui.menubar.css" rel="stylesheet"
  type="text/css" />
<script type="text/javascript" src="${pageContext.request.contextPath}/script/jquery.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/script/jquery-ui.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/script/jquery.ui.menubar.js"></script>
<script type="text/javascript"
  src="${pageContext.request.contextPath}/script/jquery-multiselect-2.0.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/script/grid/jquery.jqGrid.js"></script>
<script type="text/javascript"
  src="${pageContext.request.contextPath}/script/grid/i18n/grid.locale-en.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/script/jquery.validate.js"></script>
<script type="text/javascript"
  src="${pageContext.request.contextPath}/script/jquery-ui-combobox.custom.js"></script>
<script type="text/javascript"
  src="${pageContext.request.contextPath}/script/jquery-ui-accordion.custom.js"></script>
<s:head />
<script type="text/javascript">
  $(document).ajaxError(function(e,xhr,settings,exception) {
    var status = xhr.status;
    if (status == 401) {
      window.location.href = xhr.responseText;
    }
  });
  jQuery(function() {
    $.extend($.jgrid,{
      disableElements : function(elements) {
        if ($.isArray(elements)) {
          $.each(elements,function(index,value) {
            var el = $('input#' + value + '');
            if (el.length > 0) {
              var label = $("<label>").text(el.val());
              label.attr('id','lbl_' + value);
              label.insertAfter(el);
              var temp = $('<span/>').insertBefore(el);
              $(el).detach().attr('type','hidden').insertAfter(temp);
              temp.remove();
            }
          });
        }
      }
    });

    $.ajaxSetup({
      cache : false
    });

    $(".clickableMenu").on("click",function(e) {
      e.preventDefault();
      var id = $(this).attr('id');
      var href = $(this).attr("href");
      if (id != 'logout') {
        if (href != '#') {
          $("#mainSection").load(href,function(response,status,xhr) {
            if (status == 'error') {
              if (xhr.status == 403) {
                $("#mainSection").html(response);
              }
            }
          });
        }
      } else {
        if (confirmLogout()) {
          window.location.href = href;
        }
      }
      return false;
    });
    $('#menu').menubar({
      autoExpand : true,
      select : select
    });
  });

  function select(event,ui) {
  }
  function confirmLogout() {
    var answer = confirm("<s:property value='%{getText(\"confirm.logout\")}'/>");
    return answer;
  }
</script>
</head>
<body
  style="background-image: ${pageContext.request.contextPath}/image/header/web_subpage_background.gif">
  <div class="table">
    <div id="headerSection" class="row" style="margin-bottom: 5px;">
      <s:include value="/WEB-INF/content/home/header.jsp" />
      <div class="menubar">
        <ul class="menu" id="menu">
          <li><a href="#" class="parent"><span>Security</span></a>
            <ul>
              <li><a href="#" class="parent"><span>Master</span></a>
                <ul>
                  <li><a href="${pageContext.request.contextPath }/security/listUser.action"
                    class="clickableMenu"><span>List User</span></a></li>
                </ul></li>
            </ul></li>
          <li><a href="#" class="parent"><span>Customers</span></a>
            <ul>
              <li><a href="#" class="parent"><span>Master</span></a>
                <ul>
                  <li><a
                    href="${pageContext.request.contextPath }/customer/listCustomer.action"
                    class="clickableMenu"><span>List Customer</span></a></li>
                </ul></li>
            </ul></li>
          <li><a href="#" class="parent"><span>Products</span></a>
            <ul>
              <li><a
                href="${pageContext.request.contextPath }/inventory/productCategory/listProductCategory.action"
                class="clickableMenu"><span>Product Category</span></a></li>
              <li><a
                href="${pageContext.request.contextPath }/inventory/product/listProduct.action"
                class="clickableMenu"><span>Product</span></a></li>
            </ul></li>
          <li><a href="#" class="parent"><span>Account Receivable</span></a>
            <ul>
              <li><a
                href="${pageContext.request.contextPath }/ar/invoice/addSalesInvoice.action"
                class="clickableMenu"><span>Sales Invoice</span></a></li>
            </ul></li>
        </ul>
      </div>
    </div>
    <div class="bodySection" class="row" style="padding-top: 6px;">
      <div class="mainContent" id="mainSection" style="width: 100%;"></div>
    </div>
  </div>
</body>
</html>